
<html>
<head>

	<script>
window.onload=function(){
	
	var flag=false;
	 
	var cookies = document.cookie.split("; ");//将获得的所有cookie切割成数组 
	for(var i=0;i<cookies.length;i++)
	{
		if(cookies[i].split('=')[0]=="username"){
			document.getElementById("username").value = cookies[i].split('=')[1];
			
		}
		else if(cookies[i].split('=')[0]=="password"){
			document.getElementById("password").value = cookies[i].split('=')[1];
			
			flag = true;
		}
	}
	if(flag==true){
		var form = document.getElementById('login');
		form.submit();
	}
}	
function inputTest(){
	

	if (document.getElementById("password").value.length>4){
		return true
	} else {
	        return false;
	}
}
function inputname(){
	username = document.getElementById("username");
	if(username.value=="Please Input Your Username"){
		username.value = "";
		username.style.color = "Black";
	}
	
}
function nameempty(){
	username= document.getElementById("username")
	if(username.value == ""){
		username.value = "Please Input Your Username";
		username.style.color = "Gray";
	}
	
}

	</script>

</head>
<body>

Please Input Your Name and Password to login
<form id="login" action="login.php" method="POST" onsubmit="return inputTest()">  
    <input type="text" name="username" id="username" value="Please Input Your Username" onclick="inputname()" style="color: Gray;" onblur="nameempty()" />  <br>
    <input type="password" name="password" id="password"/>  <br>
    <input type="submit" value="Login GET"/>  
</form> 
<br>
<br>

</body>
</html>
